package com.vicmoorthy.utils.common;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.LineIterator;
import org.apache.commons.io.filefilter.IOFileFilter;

import java.io.*;
import java.math.BigInteger;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.zip.Checksum;

public class FileUtil {
 

    public File getFile(File directory, String... names) {
        return FileUtils.getFile(directory, names);
    }

    public File getFile(String... names) {
        return FileUtils.getFile(names);
    }

    public String getTempDirectoryPath() {
        return FileUtils.getTempDirectoryPath();
    }

    public File getTempDirectory() {
        return FileUtils.getTempDirectory();
    }

    public String getUserDirectoryPath() {
        return FileUtils.getUserDirectoryPath();
    }

    public File getUserDirectory() {
        return FileUtils.getUserDirectory();
    }

    public FileInputStream openInputStream(File file)  {
        try {
            return org.apache.commons.io.FileUtils.openInputStream(file);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public FileOutputStream openOutputStream(File file)  {
        try {
            return org.apache.commons.io.FileUtils.openOutputStream(file);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public FileOutputStream openOutputStream(File file, boolean append)  {
        try {
            return org.apache.commons.io.FileUtils.openOutputStream(file, append);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String byteCountToDisplaySize(BigInteger size) {
        return FileUtils.byteCountToDisplaySize(size);
    }

    public String byteCountToDisplaySize(long size) {
        return FileUtils.byteCountToDisplaySize(size);
    }

    public void touch(File file)  {
        try {
            org.apache.commons.io.FileUtils.touch(file);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public File[] convertFileCollectionToFileArray(Collection<File> files) {
        return FileUtils.convertFileCollectionToFileArray(files);
    }

    public Collection<File> listFiles(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
        return FileUtils.listFiles(directory, fileFilter, dirFilter);
    }

    public Collection<File> listFilesAndDirs(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
        return FileUtils.listFilesAndDirs(directory, fileFilter, dirFilter);
    }

    public Iterator<File> iterateFiles(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
        return FileUtils.iterateFiles(directory, fileFilter, dirFilter);
    }

    public Iterator<File> iterateFilesAndDirs(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
        return FileUtils.iterateFilesAndDirs(directory, fileFilter, dirFilter);
    }

    public Collection<File> listFiles(File directory, String[] extensions, boolean recursive) {
        return FileUtils.listFiles(directory, extensions, recursive);
    }

    public Iterator<File> iterateFiles(File directory, String[] extensions, boolean recursive) {
        return FileUtils.iterateFiles(directory, extensions, recursive);
    }

    public boolean contentEquals(File file1, File file2)  {
        try {
            return org.apache.commons.io.FileUtils.contentEquals(file1, file2);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public boolean contentEqualsIgnoreEOL(File file1, File file2, String charsetName)  {
        try {
            return org.apache.commons.io.FileUtils.contentEqualsIgnoreEOL(file1, file2, charsetName);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public File toFile(URL url) {
        return FileUtils.toFile(url);
    }

    public File[] toFiles(URL[] urls) {
        return FileUtils.toFiles(urls);
    }

    public URL[] toURLs(File[] files)  {
        try {
            return org.apache.commons.io.FileUtils.toURLs(files);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void copyFileToDirectory(File srcFile, File destDir)  {
        try {
            org.apache.commons.io.FileUtils.copyFileToDirectory(srcFile, destDir);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void copyFileToDirectory(File srcFile, File destDir, boolean preserveFileDate)  {
        try {
            org.apache.commons.io.FileUtils.copyFileToDirectory(srcFile, destDir, preserveFileDate);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void copyFile(File srcFile, File destFile)  {
        try {
            org.apache.commons.io.FileUtils.copyFile(srcFile, destFile);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void copyFile(File srcFile, File destFile, boolean preserveFileDate)  {
        try {
            org.apache.commons.io.FileUtils.copyFile(srcFile, destFile, preserveFileDate);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public long copyFile(File input, OutputStream output)  {
        try {
            return org.apache.commons.io.FileUtils.copyFile(input, output);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void copyDirectoryToDirectory(File srcDir, File destDir)  {
        try {
            org.apache.commons.io.FileUtils.copyDirectoryToDirectory(srcDir, destDir);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void copyDirectory(File srcDir, File destDir)  {
        try {
            org.apache.commons.io.FileUtils.copyDirectory(srcDir, destDir);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void copyDirectory(File srcDir, File destDir, boolean preserveFileDate)  {
        try {
            org.apache.commons.io.FileUtils.copyDirectory(srcDir, destDir, preserveFileDate);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void copyDirectory(File srcDir, File destDir, FileFilter filter)  {
        try {
            org.apache.commons.io.FileUtils.copyDirectory(srcDir, destDir, filter);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void copyDirectory(File srcDir, File destDir, FileFilter filter, boolean preserveFileDate)  {
        try {
            org.apache.commons.io.FileUtils.copyDirectory(srcDir, destDir, filter, preserveFileDate);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void copyURLToFile(URL source, File destination)  {
        try {
            org.apache.commons.io.FileUtils.copyURLToFile(source, destination);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void copyURLToFile(URL source, File destination, int connectionTimeout, int readTimeout)  {
        try {
            org.apache.commons.io.FileUtils.copyURLToFile(source, destination, connectionTimeout, readTimeout);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void copyInputStreamToFile(InputStream source, File destination)  {
        try {
            org.apache.commons.io.FileUtils.copyInputStreamToFile(source, destination);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void deleteDirectory(File directory)  {
        try {
            org.apache.commons.io.FileUtils.deleteDirectory(directory);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public boolean deleteQuietly(File file) {
        return FileUtils.deleteQuietly(file);
    }

    public boolean directoryContains(File directory, File child)  {
        try {
            return org.apache.commons.io.FileUtils.directoryContains(directory, child);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void cleanDirectory(File directory)  {
        try {
            org.apache.commons.io.FileUtils.cleanDirectory(directory);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public boolean waitFor(File file, int seconds) {
        return FileUtils.waitFor(file, seconds);
    }

    public String readFileToString(File file, Charset encoding)  {
        try {
            return org.apache.commons.io.FileUtils.readFileToString(file, encoding);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String readFileToString(File file, String encoding)  {
        try {
            return org.apache.commons.io.FileUtils.readFileToString(file, encoding);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String readFileToString(File file)  {
        try {
            return org.apache.commons.io.FileUtils.readFileToString(file);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public byte[] readFileToByteArray(File file)  {
        try {
            return org.apache.commons.io.FileUtils.readFileToByteArray(file);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public List<String> readLines(File file, Charset encoding)  {
        try {
            return org.apache.commons.io.FileUtils.readLines(file, encoding);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public List<String> readLines(File file, String encoding)  {
        try {
            return org.apache.commons.io.FileUtils.readLines(file, encoding);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public List<String> readLines(File file)  {
        try {
            return org.apache.commons.io.FileUtils.readLines(file);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public LineIterator lineIterator(File file, String encoding)  {
        try {
            return org.apache.commons.io.FileUtils.lineIterator(file, encoding);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public LineIterator lineIterator(File file)  {
        try {
            return org.apache.commons.io.FileUtils.lineIterator(file);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeStringToFile(File file, String data, Charset encoding)  {
        try {
            org.apache.commons.io.FileUtils.writeStringToFile(file, data, encoding);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeStringToFile(File file, String data, String encoding)  {
        try {
            org.apache.commons.io.FileUtils.writeStringToFile(file, data, encoding);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeStringToFile(File file, String data, Charset encoding, boolean append)  {
        try {
            org.apache.commons.io.FileUtils.writeStringToFile(file, data, encoding, append);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeStringToFile(File file, String data, String encoding, boolean append)  {
        try {
            org.apache.commons.io.FileUtils.writeStringToFile(file, data, encoding, append);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeStringToFile(File file, String data)  {
        try {
            org.apache.commons.io.FileUtils.writeStringToFile(file, data);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeStringToFile(File file, String data, boolean append)  {
        try {
            org.apache.commons.io.FileUtils.writeStringToFile(file, data, append);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void write(File file, CharSequence data)  {
        try {
            org.apache.commons.io.FileUtils.write(file, data);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void write(File file, CharSequence data, boolean append)  {
        try {
            org.apache.commons.io.FileUtils.write(file, data, append);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void write(File file, CharSequence data, Charset encoding)  {
        try {
            org.apache.commons.io.FileUtils.write(file, data, encoding);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void write(File file, CharSequence data, String encoding)  {
        try {
            org.apache.commons.io.FileUtils.write(file, data, encoding);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void write(File file, CharSequence data, Charset encoding, boolean append)  {
        try {
            org.apache.commons.io.FileUtils.write(file, data, encoding, append);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void write(File file, CharSequence data, String encoding, boolean append)  {
        try {
            org.apache.commons.io.FileUtils.write(file, data, encoding, append);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeByteArrayToFile(File file, byte[] data)  {
        try {
            org.apache.commons.io.FileUtils.writeByteArrayToFile(file, data);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeByteArrayToFile(File file, byte[] data, boolean append)  {
        try {
            org.apache.commons.io.FileUtils.writeByteArrayToFile(file, data, append);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeLines(File file, String encoding, Collection<?> lines)  {
        try {
            org.apache.commons.io.FileUtils.writeLines(file, encoding, lines);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeLines(File file, String encoding, Collection<?> lines, boolean append)  {
        try {
            org.apache.commons.io.FileUtils.writeLines(file, encoding, lines, append);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeLines(File file, Collection<?> lines)  {
        try {
            org.apache.commons.io.FileUtils.writeLines(file, lines);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeLines(File file, Collection<?> lines, boolean append)  {
        try {
            org.apache.commons.io.FileUtils.writeLines(file, lines, append);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeLines(File file, String encoding, Collection<?> lines, String lineEnding)  {
        try {
            org.apache.commons.io.FileUtils.writeLines(file, encoding, lines, lineEnding);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeLines(File file, String encoding, Collection<?> lines, String lineEnding, boolean append)  {
        try {
            org.apache.commons.io.FileUtils.writeLines(file, encoding, lines, lineEnding, append);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeLines(File file, Collection<?> lines, String lineEnding)  {
        try {
            org.apache.commons.io.FileUtils.writeLines(file, lines, lineEnding);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void writeLines(File file, Collection<?> lines, String lineEnding, boolean append)  {
        try {
            org.apache.commons.io.FileUtils.writeLines(file, lines, lineEnding, append);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void forceDelete(File file)  {
        try {
            org.apache.commons.io.FileUtils.forceDelete(file);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void forceDeleteOnExit(File file)  {
        try {
            org.apache.commons.io.FileUtils.forceDeleteOnExit(file);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void forceMkdir(File directory)  {
        try {
            org.apache.commons.io.FileUtils.forceMkdir(directory);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public long sizeOf(File file) {
        return FileUtils.sizeOf(file);
    }

    public BigInteger sizeOfAsBigInteger(File file) {
        return FileUtils.sizeOfAsBigInteger(file);
    }

    public long sizeOfDirectory(File directory) {
        return FileUtils.sizeOfDirectory(directory);
    }

    public BigInteger sizeOfDirectoryAsBigInteger(File directory) {
        return FileUtils.sizeOfDirectoryAsBigInteger(directory);
    }

    public boolean isFileNewer(File file, File reference) {
        return FileUtils.isFileNewer(file, reference);
    }

    public boolean isFileNewer(File file, Date date) {
        return FileUtils.isFileNewer(file, date);
    }

    public boolean isFileNewer(File file, long timeMillis) {
        return FileUtils.isFileNewer(file, timeMillis);
    }

    public boolean isFileOlder(File file, File reference) {
        return FileUtils.isFileOlder(file, reference);
    }

    public boolean isFileOlder(File file, Date date) {
        return FileUtils.isFileOlder(file, date);
    }

    public boolean isFileOlder(File file, long timeMillis) {
        return FileUtils.isFileOlder(file, timeMillis);
    }

    public long checksumCRC32(File file)  {
        try {
            return org.apache.commons.io.FileUtils.checksumCRC32(file);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public Checksum checksum(File file, Checksum checksum)  {
        try {
            return org.apache.commons.io.FileUtils.checksum(file, checksum);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void moveDirectory(File srcDir, File destDir)  {
        try {
            org.apache.commons.io.FileUtils.moveDirectory(srcDir, destDir);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void moveDirectoryToDirectory(File src, File destDir, boolean createDestDir)  {
        try {
            org.apache.commons.io.FileUtils.moveDirectoryToDirectory(src, destDir, createDestDir);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void moveFile(File srcFile, File destFile)  {
        try {
            org.apache.commons.io.FileUtils.moveFile(srcFile, destFile);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void moveFileToDirectory(File srcFile, File destDir, boolean createDestDir)  {
        try {
            org.apache.commons.io.FileUtils.moveFileToDirectory(srcFile, destDir, createDestDir);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void moveToDirectory(File src, File destDir, boolean createDestDir)  {
        try {
            org.apache.commons.io.FileUtils.moveToDirectory(src, destDir, createDestDir);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }

    public boolean isSymlink(File file)  {
        try {
            return org.apache.commons.io.FileUtils.isSymlink(file);
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }
}
